<template>
  <div class="el-select">
    <div
      class="el-select__wrapper logic-custom-select"
      tabindex="0"
    >
      {{ text }}
      <div
        v-if="!text"
        class="el-select__placeholder"
      >
        {{ placeholder }}
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
defineProps({
  text: {
    type: String,
    default: ""
  },
  placeholder: {
    type: String,
    default: ""
  }
});
</script>
<style scoped lang="scss">
.el-select__wrapper {
  user-select: none;
  display: inline-block;
  width: 100%;
  position: relative;
  z-index: 100;
  // 文字超出省略
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.text-placeholder-color {
  position: absolute;
  top: 5px;
  z-index: 1;
}

.el-select__wrapper:active {
  box-shadow: 0 0 0 1px var(--el-color-primary) inset;
}

.logic-custom-select::after {
  content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path></svg>'); /* SVG 箭头图标 */
  position: absolute;
  top: 20%;
  right: 10px;
  width: 14px;
  height: 14px;
  color: var(--el-select-input-color);
  cursor: pointer;
  font-size: var(--el-select-input-font-size);
  transform: rotate(0deg);
  transition: var(--el-transition-duration);
}

.logic-custom-select-expand::after {
  content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path></svg>'); /* SVG 箭头图标 */
  position: absolute;
  top: 30%;
  right: 10px;
  width: 14px;
  height: 14px;
  color: var(--el-select-input-color);
  cursor: pointer;
  font-size: var(--el-select-input-font-size);
  transition: var(--el-transition-duration);
  transform: rotate(180deg);
}
</style>
